<?php echo $this->element('menu', array("active" => "10.a"));?>
<ul class="breadcrumb">
        <li>
          <?php echo $this->Html->link(__('Shop  ', true), array('action' => 'index'), array('class'=>'fist_link'));?>
        </li>
        <li>
           <a href="#" >Orders</a>
        </li>
      </ul>
<div id="content">
<div id="left" class="hight_resize m_t_15" >
<table width="100%">
<tr>
    <td width="80%" nowrap="nowrap"><a> Open </a>|<a> Pending </a>|<a> Dispatched </a></td>
</tr>

</table>
  <div class="table table_p_15_2 boder m_t_15 ">
  

    <table width="100%"  cellpadding="0" cellspacing="0" align="right">
      <thead>
        <tr>
          <td >#</td>
          <td >Orderer</td>
          <td >Items</td>
          <td >Shipping to</td>
          <td>Pirce</td>
          <td valign="top"></td>
        </tr>
      </thead>
      <tbody>
        <?php
        //debug($orders);exit();
        $i = 0;
        foreach ($orders as $order):
        
        $class = null;
        if ($i++ % 2 == 0) {
            $class = ' class="altrow"';
        }
        ?>
        <tr <?php if(!$order['Order']['view'] ) echo 'class = "bold"';?>>
          <td><?php echo $i;?></td>
          <td ><?php echo $order['Agent']['first_name']." ".$order['Agent']['last_name']; ?></td>
          <td ><?php $y=0; $pirce = 0;foreach ($order['OrderPart'] as $order_part):  $y++;  $pirce = $pirce + $order_part['Part']['price'];endforeach; echo $y;?></td>
          <td ><?php echo $order['Order']['shipping_to']; ?></td>
          <td><?php echo $pirce;?></td>
          <td valign="top" align="right"><?php echo $this->Html->link(__('View', true), array('action' => 'view', $order['Order']['id'])); ?></td>
        </tr>
        <?php endforeach; ?>
      </tbody>
    </table>
  </div>
  <div class="paging">
        <?php echo $this->Paginator->numbers();?>
  </div>
</div>
<div id="right" class="hight_resize" >
  <fieldset class="form">
    <form>
      <div class="input">
        <label class="w90">Contact name:</label>
        <input type="text" value="" class="w140"/>
        <div class="error-message">Error message will be put here</div>
      </div>
      <div class="input">
        <label class="w90">Company:</label>
        <input type="text" value="" class="w140"/>
      </div>
      <div class="input">
        <label class="w90">Email:</label>
        <input type="text" value="" class="w140"/>
      </div>
      <div class="input">
        <label class="w90">Phone:</label>
        <input type="text" value="" class="w140"/>
      </div>
      <input type="submit" value="Find order" class="bt bt_search" />
    </form>
  </fieldset>
</div>
</div>